package com.yanqu.road.entity.activity.evefeast.config;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

@FieldTypeAnnotation(tableName = "t_s_activity_evefeast_achieve")
public class EveFeastAchieveConfig extends DataObject {
    @FieldTypeAnnotation(select = true, orderASC = true, isIndex = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "单局成就id", isIndex = true)
    private int id;
    @FieldTypeAnnotation(desc = "分类")
    private int type;
    @FieldTypeAnnotation(desc = "条件")
    private String condition;

    private Property conditionProperty = new Property();

    public EveFeastAchieveConfig(int activityId, int id) {
        this.activityId = activityId;
        this.id = id;
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;

        if (!StringUtils.isNullOrEmpty(condition)) {
           this.conditionProperty = PropertyHelper.parseStringToProperty(condition,"\\|");
        }
    }

    public Property getConditionProperty() {
        return new Property(conditionProperty);
    }
}
